package com.mier.android.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.gsm.SmsMessage;

public class SMSReceiver extends BroadcastReceiver{

	@Override
	public void onReceive(Context ctx, Intent intent) {
		String sender;
		String message;
		Bundle bundle = intent.getExtras();
		if(bundle!=null){
			Object[] pdusObj = (Object[]) bundle.get("pdus");
			SmsMessage[] messages = new SmsMessage[pdusObj.length];
			
			for(SmsMessage currentMessage : messages){
				sender = currentMessage.getDisplayOriginatingAddress();
				message = currentMessage.getDisplayMessageBody();
			}
		}
	}

}
